#include <stdio.h>

int wordlength(unsigned v);
unsigned rightrot(unsigned x, int n);

int main(void) {
    printf("%u\n", rightrot(181, 2));
    return 0;
}

unsigned rightrot(unsigned x, int n) {
    int len;
    len = wordlength(x);
    return (x >> n) | ((~(~0<<n)&x) << (len-n));
}

int wordlength(unsigned v) {
    int i;
    for(i=1;(v=v>>1)>0;i++) {;}
    return i;
}